Docker Client
Client for one Docker host, using fixed API version 1.51 and a Unix socket.
Reuse an instance for application-scoped work, or use Kotlin use for a short-lived client. close shuts down the owned HTTP client; raw exec/attach sessions must be closed separately. No API negotiation, Docker context discovery or automatic retry/reconnect is performed.
Import dev.limebeck.libs.docker.client.api.* to access containers, images, exec and other API groups.
Parameters
Serialization, endpoint and in-memory registry authentication settings.
See also
Samples
DockerClient(DockerClientConfig(
connectionConfig = DockerClientConfig.ConnectionConfig.SocketConnection(socketPath),
)).use { docker ->
docker.system.ping().getOrThrow()
docker.containers.getList().getOrThrow().forEach { println(it.names) }
}Properties
Cached Compose integration using this client's endpoint and lifetime.
Cached containers API bound to this client and its connection configuration.
Cached exec API bound to this client and its connection configuration.
Cached images API bound to this client and its connection configuration.
Cached networks API bound to this client and its connection configuration.
Cached Swarm API using this client's endpoint and lifetime.
Cached system API bound to this client and its connection configuration.
Cached volumes API bound to this client and its connection configuration.
Functions
Live streams may be idle indefinitely; the collector owns their lifetime.
Validates registry credentials through Docker and stores successful authentication in DockerClientConfig.auth.
Validate transport completion as well as status; CIO can report a short body as clean EOF.
Probes the configured daemon using the SDK's versioned ping without changing daemon state. A successful probe establishes reachability/API acceptance, not permission for every Docker operation. Does not retry or close this client. Cancellation from the caller always propagates.
Describes an upstream transport exception without retrying or modifying it. Use for failures from HTTP calls, stream collection or exec/attach. Do not use to label application callback errors. Recognizes common exception names and OS messages/codes; unsupported/localized messages remain UNKNOWN. Cancellation is rethrown. Clean stream EOF has no exception and requires application-owned reconciliation.
Handles bodyless HEAD errors and non-JSON daemon/proxy responses.
An HTTP error Result retaining safe request context for getOrThrow.
Cold streams surface HTTP failures during collection, before decoding data.
Docker can report an operation failure inside a successful NDJSON response.